package lab.gene.action;

import java.util.Date;
import java.util.List;

import lab.gene.pojo.GeneAmpliconPCR;
import lab.gene.pojo.GeneImageFile;
import lab.gene.service.impl.GeneAmpliconPCRServiceImpl;
import lab.gene.service.impl.GeneImageFileServiceImpl;

import com.opensymphony.xwork2.ActionSupport;

public class ViewGeneAmpliconPCRAction extends ActionSupport {
	
	private static final long serialVersionUID = 1L;
	private List<GeneImageFile> imageList = null;
	private Date recordDate = null;
	private String strain = null;
	private int exsize;
	private String seqConfirmed = null;
	private String comments = null;
	private String geneName = null;
	private String type = null;
	
	public String execute() {
		String result = null;
		System.out.println("View Amplicon PCR Action");
		GeneAmpliconPCRServiceImpl service = new GeneAmpliconPCRServiceImpl();
		GeneAmpliconPCR g = null;
		g = service.getGeneAmpliconPCRByNameAndType(geneName, type);
		if (g != null) {
			recordDate = g.getRecordDate();
			strain = g.getStrain();
			exsize = g.getExsize();
			seqConfirmed = g.getSeqConfirmed();
			comments = g.getComments();
		}
		String formName = null;
		GeneImageFileServiceImpl fService = new GeneImageFileServiceImpl();	
		switch (type) {
		case "C":
			formName = "C Amplicon PCR";
			setImageList(fService.getGeneImageFilesByGeneNameAndFormName(geneName, formName));
			result = "successC";
			break;
		case "D":
			formName = "D Amplicon PCR";
			setImageList(fService.getGeneImageFilesByGeneNameAndFormName(geneName, formName));
			result = "successD";
			break;
		}
		System.out.println("returninig");
		return result;
	}
	public Date getRecordDate() {
		return recordDate;
	}
	public void setRecordDate(Date recordDate) {
		this.recordDate = recordDate;
	}
	public String getStrain() {
		return strain;
	}
	public void setStrain(String strain) {
		this.strain = strain;
	}
	public int getExsize() {
		return exsize;
	}
	public void setExsize(int exsize) {
		this.exsize = exsize;
	}
	public String getSeqConfirmed() {
		return seqConfirmed;
	}
	public void setSeqConfirmed(String seqConfirmed) {
		this.seqConfirmed = seqConfirmed;
	}
	public String getComments() {
		return comments;
	}
	public void setComments(String comments) {
		this.comments = comments;
	}
	public String getGeneName() {
		return geneName;
	}
	public void setGeneName(String geneName) {
		this.geneName = geneName;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public List<GeneImageFile> getImageList() {
		return imageList;
	}
	public void setImageList(List<GeneImageFile> imageList) {
		this.imageList = imageList;
	}
	
	

}
